<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>html</title>
	<link rel="stylesheet" type="text/css" href="../../js/easyui/themes/bootstrap/easyui.css">
	<link rel="stylesheet" type="text/css" href="../../js/easyui/themes/icon.css">
	<link rel="stylesheet" type="text/css" href="../../js/selfcss/demo.css">
	<script type="text/javascript" src="../../js/easyui/jquery.min.js"></script>
	<script type="text/javascript" src="../../js/easyui/jquery.easyui.min.js"></script>
</head>
	<body class="easyui-layout" fit="true" id="body" >
        <div data-options="region:'north',title:'查询条件',hideCollapsedContent:false,collapsed:false" style="height:80px;" id="north">
          <div style="width: 65%;float:left;">
           <form id="ff" style="text-align: center;margin-top: 15px;margin-left: 15px;" method="post"> 
		    	<table cellpadding="0" cellspacing="0" class="table-striped">
		    		<tr>		    		   		    		   
		    		     <td>任务组：</td>
		    		      <td>
		    			   <input class="easyui-combobox" data-options="
							valueField: 'label',
							textField: 'value',
							url:' ../../searchSelectPsDicts?moudle=SYS_GROUP'" name="jobGroup"/>
		    			 </td>
		    		   
		    		      <td>任务名：</td>
		    		      <td>
		    			  <input name="jobName" id="jobName" type="text" class="easyui-validatebox txt"/>
		    			 </td>
		    		</tr>
		    	</table>
		    </form>
          </div>
          <div style="width: 30%;float:right;margin-top: 15px;">
            <a href="javascript:Handler.searchData()" class="easyui-linkbutton"  style="width:80px">查询</a>
            <a href="javascript:Handler.resetFormData()" class="easyui-linkbutton"  style="width:80px">重置</a>
          </div>
        </div>
        
        <div data-options="region:'center',split:false" >
			<table id="tablelist" class="easyui-datagrid"  style="width:auto;" fitcolumns="true" fit="true" 
			data-options="singleSelect:false,pagination:true,url:'../../searchAutoPageSystemQrtzTriggerLogs',method:'get',toolbar:toolbar">
				<thead>
					<tr>					   
					    <th data-options="field:'ck',checkbox:true"></th>
						<th data-options="field:'jobGroupName',width:100,align:'center'">任务组</th>
						<th data-options="field:'jobName',width:100,align:'center'">任务名</th>
						<th data-options="field:'jobCron',width:100,align:'center'">cron表达式</th>
						<th data-options="field:'jobClassName',width:100,align:'center'">执行方式</th>
						<th data-options="field:'triggerTimeString',width:100,align:'center'">调度时间</th>
						<th data-options="field:'triggerStatus',width:100,align:'center'">调度结果</th>
						<th data-options="field:'handleTimeString',width:100,align:'center'">执行时间</th>
						<th data-options="field:'handleStatus',width:100,align:'center'">执行状态</th>
					</tr>
				</thead>
			</table>
		</div>
		<div id="formwin" class="easyui-window"  data-options="iconCls:'icon-save',closed:true" >
		   <form id="infoForm" method="post" style="text-align: center;margin-top: 20px;margin-left: 50px;">
			    <input type="hidden" id="id" name="id" />
			  	<table class="common-table" style="border-collapse:separate; border-spacing:15px;" cellspacing="15" cellpadding="0">
			  	  <tr>
			  	    <th>任务组：</th>
			  	     <td>
		    			  <input name="jobGroup" id="jobGroup" type="text" class="easyui-validatebox txt"/>
			  	     </td>
			  	    <th>任务名：</th>
			  	     <td>
		    			  <input name="jobName" id="jobName" type="text" class="easyui-validatebox txt"/>
			  	     </td>
			  	    </tr>
			  	  <tr>
			  	    <th>cron表达式：</th>
			  	     <td>
		    			  <input name="jobCron" id="jobCron" type="text" class="easyui-validatebox txt"/>
			  	     </td>
			  	    <th>任务描述：</th>
			  	     <td>
		    			  <input name="jobDesc" id="jobDesc" type="text" class="easyui-validatebox txt"/>
			  	     </td>
			  	    </tr>
			  	  <tr>
			  	    <th>执行方式：</th>
			  	     <td>
		    			  <input name="jobClass" id="jobClass" type="text" class="easyui-validatebox txt"/>
			  	     </td>
			  	    <th>任务数据：</th>
			  	     <td>
		    			  <input name="jobData" id="jobData" type="text" class="easyui-validatebox txt"/>
			  	     </td>
			  	    </tr>
			  	  <tr>
			  	    <th>调度时间：</th>
			  	     <td>
						 	<input id="triggerTime" type="text" class="easyui-datebox" name="triggerTime">
			  	     </td>
			  	    <th>调度结果：</th>
			  	     <td>
		    			  <input name="triggerStatus" id="triggerStatus" type="text" class="easyui-validatebox txt"/>
			  	     </td>
			  	    </tr>
			  	  <tr>
			  	    <th>调度日志：</th>
			  	     <td>
		    			  <input name="triggerMsg" id="triggerMsg" type="text" class="easyui-validatebox txt"/>
			  	     </td>
			  	    <th>执行时间：</th>
			  	     <td>
						 	<input id="handleTime" type="text" class="easyui-datebox" name="handleTime">
			  	     </td>
			  	    </tr>
			  	  <tr>
			  	    <th>执行状态：</th>
			  	     <td>
		    			  <input name="handleStatus" id="handleStatus" type="text" class="easyui-validatebox txt"/>
			  	     </td>
			  	    <th>执行日志：</th>
			  	     <td>
		    			  <input name="handleMsg" id="handleMsg" type="text" class="easyui-validatebox txt"/>
			  	     </td>
			  	    </tr>
			  	</table>
  			</form>
  			<div id="dlg-buttons2" style="text-align: center;vertical-align: middle;margin-top: 20px;">
				
				<a href="javascript:void(0)" class="easyui-linkbutton c5"
					onclick="javascript:$('#formwin').window('close');"
					style="width: 90px">关闭</a>					
				<a href="javascript:void(0)" class="easyui-linkbutton c6"
					 onclick="javascript:Handler.saveData();" style="width: 90px">保存</a>	
			</div>
    	</div>
		<script type="text/javascript">
        var toolbar = [{
            text:'删除',
            iconCls:'icon-cut',
            handler:function(){Handler.deleteData()}
        }];
      //设置分页控件  
      $(document).ready(function() {
    	  var p = $('#tablelist').datagrid('getPager');  
          p.pagination({  
              pageSize: 10,//每页显示的记录条数，默认为10  
              pageList: [10, 20, 50],//可以设置每页记录条数的列表  
              beforePageText: '第',//页数文本框前显示的汉字  
              afterPageText: '页    共 {pages} 页',  
              displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录'  
          });  
      });
      var Handler = {
    			deleteData: function(){ 
      			  var rows = $('#tablelist').datagrid('getChecked');
      			  var ids = [];
				  for(var index in rows){
						 var r = rows[index];
			             	ids.push(r.id);
						}
				  var userIds = ids.join(','); 
      			  $.messager.confirm('信息提示', '确认是否删除数据?', function(r){
      	                if (r){
      	                	$.post("../../removeAutoPageSystemQrtzTriggerLog",{ids:userIds},function(data,state){
      	    					 if(state=="success" && data.status==200){
      	    						 $('#tablelist').datagrid('reload'); 
      	    						 $('#ff').form('clear');
      	    					 }else{
      	    						 $.messager.alert('失败信息',data.message,'error');
      	    					 }	
      	  					},"json");
      	                }
      	            }); 
      			},
      		  resetFormData: function(){
      			$('#ff').form('clear');
      		  },
      		  searchData: function(){
      			  var params=getFormData("ff");
      			  $('#tablelist').datagrid('load',params);
      		  },
      		searchDataById: function(){
      			var rowsChecked = $('#tablelist').datagrid('getChecked');
      			var url="../../"+rowsChecked[0].id+"/searchAutoPageSystemQrtzTriggerLog";
      			$.get(url, function(data){
    				if(data.status==200){
    					$('#infoForm').form('load', data.data);
    					$("#dlg-buttons2").css('display','none');
    				}
    			},"json");
      			openWindow("formwin","查询页面","icon-search");
    		  },
      		 
       		 saveData: function(){
       			 var params=getFormData("infoForm");
       			 var url="";
       			 if(params.id){//存在
       				url="../../editAutoPageSystemQrtzTriggerLog";
       			 }else{
       				 url="../../autoPageSystemQrtzTriggerLog";
       			 }
       			 $.post(url,params,function(data,state){
					 if(state=="success" && data.status==200){
						 $('#infoForm').form('clear');
						 $('#formwin').window('close');
						 var params=getFormData("ff");
		      			 $('#tablelist').datagrid('load',params);
					 }else{
						 $.messager.alert('失败信息',data.message,'error');
						 $('#infoForm').form('clear');
					 }	
					},"json");
       		  }
      };
      function getFormData(id){
    	    var data = $("#"+id).serializeArray();
    		var item,key,value,newData={};
    		for(var i=0;i<data.length;i++){
    			item = data[i];
    			key = item.name;
    			if(item.value){
    				value = item.value;
        			newData[key] = value;
    			}
    		}	
    		return newData;
    	}
      
      function openWindow(id,title,iconcls){
    	  $('#'+id).window({
			    width:850,
			    height:400,
			    top:($("#body").height() - 400) * 0.5,   
              	left:($("#body").width() - 800) * 0.5,
              	shadow: true,
              	collapsible:false,
              	minimizable:false,
              	maximizable:false,
              	iconCls:iconcls,
			    title:title,
			    modal:true
			});
			 $('#'+id).window('open');
      }
    </script>
		
	</body>
	
</html>